package com.zenithsun.common.bean;

import java.util.Map;

import org.apache.solr.client.solrj.SolrQuery;

/**
 * solr查询条件
 * @author wanglei@enersun.com.cn
 * @createTime 2016-7-20 11:35:10
 */
public abstract class SolrSearch<T>{
	
	private T search;
	
	/**
	 * 开始条数
	 */
	private int start;
	
	/**
	 * 每页显示条数
	 */
	private int limit;
	
	/**
	 * 是否高亮
	 */
	private boolean hightlight;
	
	/**
	 * 查询条件
	 */
	private String searchCondition;
	
	/**
	 * 分页条件
	 */
	private Map<String,SolrQuery.ORDER> orderMap;
	
	public SolrSearch(){
		
	}
	
	public SolrSearch(T t){
		this.search=t;
		createSearchCondition();
//		createOrder();
	}
	
	public SolrSearch(T t,int start,int limit,boolean hightlight){
		this(t);
		this.setStart(start);
		this.setLimit(limit);
		this.setHightlight(hightlight);
	}
	
	/**
	 * 创建查询条件
	 */
	public abstract void createSearchCondition();
	
	/**
	 * 创建排序方式
	 */
//	public abstract void createOrder();
	
	public T getSearch() {
		return this.search;
	}

	/**
	 * 开始条数
	 * @return
	 */
	public int getStart(){
		return start;
	}
	
	/**
	 * 每页显示条数
	 * @return
	 */
	public int getLimit(){
		return limit;
	}
	
	/**
	 * 是否高亮
	 * @return
	 */
	public boolean isHightlight(){
		return hightlight;
	}
	
	public void setStart(int start) {
		this.start = start;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public void setHightlight(boolean hightlight) {
		this.hightlight = hightlight;
	}
	
	public Map<String, SolrQuery.ORDER> getOrderMap() {
		return orderMap;
	}

	public void setOrderMap(Map<String, SolrQuery.ORDER> orderMap) {
		this.orderMap = orderMap;
	}

	public String getSearchCondition() {
		return searchCondition;
	}

	public void setSearchCondition(String searchCondition) {
		this.searchCondition = searchCondition;
	}
}
